# -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer, DateTime, String, func
import datetime

from utils.work_db import Base

"""
我的收藏
"""


class UserCollection(Base):
    __tablename__ = 'user_collection'
    collection_id = Column(Integer, primary_key=True, autoincrement=True)
    user_id = Column(Integer)
    job_id = Column(Integer)
    user_name = Column(String)
    collect_date = Column(DateTime)
    status = Column(Integer, default=1)
    create_time = Column(DateTime, default=func.now())
    update_time = Column(DateTime, default=func.now())

    def json(self):
        return {
            'collection_id': self.collection_id,
            'user_id': self.user_id,
            'user_name': self.user_name,
            'job_id': self.job_id,
            'collect_date': self.collect_date,
            'status': self.status
        }
